{extend name="base/base-order-layout"/}

{block name="linkCss"}
<link rel="stylesheet" href="__STATIC__/css/goods/goods.css">
<link rel="stylesheet" href="__STATIC__/css/order/order-form.css">
<link rel="stylesheet" href="__STATIC__/css/order/order-freight.css">
{/block}

{block name="breadcrumb"}
<a>商家管理中心</a>
<a>订单管理</a>
<a>配送管理</a>
{/block}

{block name="main"}
<div class="goodlist">
    <div class="menu-bar">
        <ul>
            <li {eq name="op" value=""}class="active"{/eq}><a href="{:think\\Url::build('freight')}">运费设置</a></li>
            <li {eq name="op" value="default"}class="active"{/eq}><a href="{:think\\Url::build('freight','op=default')}">默认物流公司</a></li>
            <li {eq name="op" value="area"}class="active"{/eq}><a href="{:think\\Url::build('freight','op=area')}">配送范围</a></li>
            {eq name="op" value="add"}<li class="active"><a href="{:think\\Url::build('freight','op=add')}">添加运费模版</a></li>{/eq}
            {eq name="op" value="edit"}<li class="active"><a href="{:think\\Url::build('freight','op=add')}">编辑运费模版</a></li>{/eq}
        </ul>
        {eq name="op" value=""}<a class="layui-btn" href="{:think\\Url::build('freight','op=add')}"><i class="iconfont icon-tianjia1"></i>添加运费模版</a>{/eq}
    </div>
    {if $op == ''}
    <div id="section1">
        <div class="table-wrap">
            <form class="layui-form" lay-verType="alert" id="form" method="post">
                <table class="table-list-style" width="100%" cellspacing="0" cellpadding="0">
                    <tbody>
                    <tr>
                        <th width="130" class="tl">
                            <label class="checkbox"><input lay-filter="checkall" lay-ignore="" class="checkall" type="checkbox"></label> 配送区域
                        </th>
                        <th width="80"> 首重重量</th>
                        <th width="80">首重费用</th>
                        <th width="80">续重重量</th>
                        <th width="80">续重费用</th>
                        <th width="100">满X元免运费</th>
                        <th>配送描述</th>
                        <th width="100">操作</th>
                    </tr>

                    <tr>
                        <td class="tl"><label class="checkbox"><input lay-ignore="" class="checkitem" name="chk[]" value="40" type="checkbox"></label>其他</td>
                        <td><span class="number">1</span>Kg</td>
                        <td><span class="number">55.00</span>元</td>
                        <td><span class="number">0.50</span>Kg</td>
                        <td><span class="number">10.00</span>元</td>
                        <td><span class="number">238.00</span>元</td>
                        <td></td>
                        <td>
                            <span class="editnbr"><a href="{:think\\Url::build('freight','op=edit')}"><i class="iconfont icon-bianji"></i>编辑</a></span>
                        </td>
                    </tr>

                    <tr>
                        <td class="toolBar" colspan="1">
                            <input name="act" value="del" type="hidden">
                            <label class="checkbox"><input lay-ignore="" lay-filter="checkall" class="checkall" type="checkbox">全选</label>
                            <span>|</span>
                            <label lay-submit class="del"><i class="iconfont icon-shanchu"></i>删除</label>
                        </td>
                        <td colspan="99">
                            <div class="page">
                                <b>1</b>
                                <a href="?firstRow=10&amp;totalRows=217&amp;m=goods&amp;s=online&amp;key=">2</a>
                                <a href="?firstRow=20&amp;totalRows=217&amp;m=goods&amp;s=online&amp;key=">3</a>
                                <a href="?firstRow=30&amp;totalRows=217&amp;m=goods&amp;s=online&amp;key=">4</a>
                                <a href="?firstRow=40&amp;totalRows=217&amp;m=goods&amp;s=online&amp;key=">5</a>
                                <a href="?firstRow=50&amp;totalRows=217&amp;m=goods&amp;s=online&amp;key=">6</a>
                                <a href="?firstRow=60&amp;totalRows=217&amp;m=goods&amp;s=online&amp;key=">7</a>
                                <a href="?firstRow=70&amp;totalRows=217&amp;m=goods&amp;s=online&amp;key=">8</a>
                                <a href="?firstRow=80&amp;totalRows=217&amp;m=goods&amp;s=online&amp;key=">9</a>
                                <a href="?firstRow=90&amp;totalRows=217&amp;m=goods&amp;s=online&amp;key=">10</a>
                                <a href="?firstRow=210&amp;totalRows=217&amp;m=goods&amp;s=online&amp;key=">..22</a>
                                <a class="nextPage"
                                   href="?firstRow=10&amp;totalRows=217&amp;m=goods&amp;s=online&amp;key=">下一页</a>
                            </div>
                        </td>
                    </tr>
                    </tbody>
                </table>
            </form>
        </div>
    </div>
    {elseif $op == 'default'/}
    <div class="section2">
        <div class="default-wrap">
            <form action="" class="layui-form">
                <table class="layui-table" lay-skin="line">
                    <colgroup>
                        <col width="25%">
                        <col width="25%">
                        <col width="25%">
                        <col>
                    </colgroup>
                    <tbody>
                    <tr>
                        <th colspan="4">物流公司</th>
                    </tr>
                    <tr>
                        <td class="tl">
                            <label class="checkbox">
                                <input lay-ignore="" name="id[]" value="1" type="checkbox">
                                AAE快递
                            </label>
                        </td>
                        <td class="tl">
                            <label class="checkbox">
                                <input lay-ignore="" name="id[]" value="2" type="checkbox">
                                安捷快递
                            </label>
                        </td>
                        <td class="tl">
                            <label class="checkbox">
                                <input lay-ignore="" name="id[]" value="3" type="checkbox">
                                安信达快递
                            </label>
                        </td>
                        <td class="tl">
                            <label class="checkbox">
                                <input lay-ignore="" name="id[]" value="4" type="checkbox">
                                Aramex国际快递
                            </label>
                        </td>
                    </tr>
                    <tr>
                        <td class="tl">
                            <label class="checkbox">
                                <input lay-ignore="" name="id[]" value="1" type="checkbox">
                                AAE快递
                            </label>
                        </td>
                        <td class="tl">
                            <label class="checkbox">
                                <input lay-ignore="" name="id[]" value="2" type="checkbox">
                                安捷快递
                            </label>
                        </td>
                        <td class="tl">
                            <label class="checkbox">
                                <input lay-ignore="" name="id[]" value="3" type="checkbox">
                                安信达快递
                            </label>
                        </td>
                        <td class="tl">
                            <label class="checkbox">
                                <input lay-ignore="" name="id[]" value="4" type="checkbox">
                                Aramex国际快递
                            </label>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="4">
                            <button class="layui-btn layui-btn-normal" lay-submit>确认提交</button>
                        </td>
                    </tr>
                    </tbody>
                </table>
            </form>
        </div>
    </div>
    {elseif $op == 'area'/}
    <div class="section3">
        <div class="area-wrap">
            <form action="" class="lauyi-form">
                <table class="layui-table" lay-skin="line">
                    <colgroup>
                        <col width="100">
                        <col>
                    </colgroup>
                    <tbody>
                    <tr>
                        <td>
                            <label class="checkbox province"><input name="province[]" value="0" type="checkbox">其他</label>
                        </td>
                        <td>
                            <ul>
                                <li><label class="checkbox city"><input lay-ignore="" name="city[]" data-count="37" data-province="0" value="0" type="checkbox"><input name="allcity[]" value="0" type="hidden">其他<span>(37)</span></label></li>
                                <li><label class="checkbox city"><input lay-ignore="" name="city[]" data-count="1" data-province="0" value="1" type="checkbox"><input name="allcity[]" value="1" type="hidden">北京<span>(1)</span></label></li>
                                <li><label class="checkbox city"><input lay-ignore="" name="city[]" data-count="1" data-province="0" value="2" type="checkbox"><input name="allcity[]" value="2" type="hidden">天津<span>(1)</span></label></li>
                                <li><label class="checkbox city"><input lay-ignore="" name="city[]" data-count="1" data-province="0" value="2" type="checkbox"><input name="allcity[]" value="2" type="hidden">天京<span>(1)</span></label></li>
                            </ul>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <label class="checkbox province"><input name="province[]" value="0" type="checkbox">北京</label>
                        </td>
                        <td>
                            <ul>
                                <li><label class="checkbox city"><input lay-ignore="" name="city[]" data-count="37" data-province="0" value="0" type="checkbox"><input name="allcity[]" value="0" type="hidden">其他<span>(37)</span></label></li>
                                <li><label class="checkbox city"><input lay-ignore="" name="city[]" data-count="1" data-province="0" value="1" type="checkbox"><input name="allcity[]" value="1" type="hidden">北京<span>(1)</span></label></li>
                                <li><label class="checkbox city"><input lay-ignore="" name="city[]" data-count="1" data-province="0" value="2" type="checkbox"><input name="allcity[]" value="2" type="hidden">天津<span>(1)</span></label></li>
                            </ul>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2">
                            <button class="layui-btn layui-btn-normal" lay-submit>确认提交</button>
                        </td>
                    </tr>
                    </tbody>
                </table>
            </form>
        </div>
    </div>
    {elseif $op == 'add'/}
    <div id="section4">
        <div class="add-wrap">
            <div class="pannel-content">
                <form action="" class="layui-form">
                    <ul>
                        <li>
                            <div class="layui-form-item">
                                <div class="layui-inline">
                                    <label class="layui-form-label"><span class="req red">*</span>首重重量：</label>
                                    <div class="layui-input-inline">
                                        <input lay-verify="required|number" name="firstweight" class="layui-input">
                                        <a class="layui-btn layui-btn-sm layui-btn-normal tag">kg</a>
                                    </div>
                                </div>
                                <div class="layui-inline">
                                    <label class="layui-form-label"><span class="req red">*</span>首重费用：</label>
                                    <div class="layui-input-inline">
                                        <input lay-verify="required|number" name="firstfee" class="layui-input">
                                        <a class="layui-btn layui-btn-sm layui-btn-normal tag">元</a>
                                    </div>
                                </div>
                            </div>
                        </li>
                        <li>
                            <div class="layui-form-item">
                                <div class="layui-inline">
                                    <label class="layui-form-label"><span class="req red">*</span>续重重量：</label>
                                    <div class="layui-input-inline">
                                        <input lay-verify="required|number" name="additionalweight" class="layui-input">
                                        <a class="layui-btn layui-btn-sm layui-btn-normal tag">kg</a>
                                    </div>
                                </div>
                                <div class="layui-inline">
                                    <label class="layui-form-label"><span class="req red">*</span>续重费用：</label>
                                    <div class="layui-input-inline">
                                        <input lay-verify="required|number" name="additionalfee" class="layui-input">
                                        <a class="layui-btn layui-btn-sm layui-btn-normal tag">元</a>
                                    </div>
                                </div>
                            </div>
                        </li>
                        <li>
                            <div class="layui-form-item">
                                <label class="layui-form-label"><span class="req red">*</span>满X元免运费：</label>
                                <div class="layui-input-inline">
                                    <input lay-verify="required|number" name="freight" class="layui-input">
                                    <a class="layui-btn layui-btn-sm layui-btn-normal tag">元</a>
                                </div>
                            </div>
                        </li>
                        <li>
                            <div class="layui-form-item">
                                <label class="layui-form-label"><span class="req red">*</span>配送描述：</label>
                                <div class="layui-input-block">
                                    <input type="text" name="description" class="layui-input" placeholder="请输入配送描述" >
                                </div>
                            </div>
                        </li>
                        <li class="nopadding ps">
                            <dl>
                                <dt>
                                    <label class="checkbox province"><input lay-ignore="" name="province[]" value="0" type="checkbox">其他</label>
                                </dt>
                                <dd>
                                    <ul class="area">
                                        <li><label class="checkbox city"><input lay-ignore="" name="city[]" data-province="0" value="0" type="checkbox">其他</label></li>
                                        <li><label class="checkbox city"><input lay-ignore="" name="city[]" data-province="0" value="1" type="checkbox">北京</label></li>
                                        <li><label class="checkbox city"><input lay-ignore="" name="city[]" data-province="0" value="2" type="checkbox">天津</label></li>
                                        <li><label class="checkbox city"><input lay-ignore="" name="city[]" data-province="0" value="3" type="checkbox">河北</label></li>
                                        <li><label class="checkbox city"><input lay-ignore="" name="city[]" data-province="0" value="4" type="checkbox">山西</label></li>
                                        <li><label class="checkbox city"><input lay-ignore="" name="city[]" data-province="0" value="5" type="checkbox">内蒙古</label></li>
                                        <li><label class="checkbox city"><input lay-ignore="" name="city[]" data-province="0" value="6" type="checkbox">上海</label></li>
                                        <li><label class="checkbox city"><input lay-ignore="" name="city[]" data-province="0" value="7" type="checkbox">江苏</label></li>
                                        <li><label class="checkbox city"><input lay-ignore="" name="city[]" data-province="0" value="8" type="checkbox">浙江</label></li>
                                        <li><label class="checkbox city"><input lay-ignore="" name="city[]" data-province="0" value="9" type="checkbox">安徽</label></li>
                                    </ul>
                                </dd>
                            </dl>
                        </li>
                        <li class="nopadding ps">
                            <dl>
                                <dt>
                                    <label class="checkbox province"><input lay-ignore="" name="province[]" value="0" type="checkbox">其他</label>
                                </dt>
                                <dd>
                                    <ul class="area">
                                        <li><label class="checkbox city"><input lay-ignore="" name="city[]" data-province="0" value="0" type="checkbox">其他</label></li>
                                        <li><label class="checkbox city"><input lay-ignore="" name="city[]" data-province="0" value="1" type="checkbox">北京</label></li>
                                        <li><label class="checkbox city"><input lay-ignore="" name="city[]" data-province="0" value="2" type="checkbox">天津</label></li>
                                        <li><label class="checkbox city"><input lay-ignore="" name="city[]" data-province="0" value="3" type="checkbox">河北</label></li>
                                        <li><label class="checkbox city"><input lay-ignore="" name="city[]" data-province="0" value="4" type="checkbox">山西</label></li>
                                        <li><label class="checkbox city"><input lay-ignore="" name="city[]" data-province="0" value="5" type="checkbox">内蒙古</label></li>
                                        <li><label class="checkbox city"><input lay-ignore="" name="city[]" data-province="0" value="6" type="checkbox">上海</label></li>
                                        <li><label class="checkbox city"><input lay-ignore="" name="city[]" data-province="0" value="7" type="checkbox">江苏</label></li>
                                        <li><label class="checkbox city"><input lay-ignore="" name="city[]" data-province="0" value="8" type="checkbox">浙江</label></li>
                                        <li><label class="checkbox city"><input lay-ignore="" name="city[]" data-province="0" value="9" type="checkbox">安徽</label></li>
                                    </ul>
                                </dd>
                            </dl>
                        </li>
                        <li>
                            <div class="layui-form-item">
                                <label class="layui-form-label">

                                </label>
                                <div class="layui-input-block">
                                    <button class="layui-btn layui-btn-normal" lay-submit>确认提交</button>
                                </div>
                            </div>
                        </li>
                    </ul>
                </form>
            </div>
        </div>
    </div>
    {elseif $op == 'edit'/}
    <div id="section5">
        <div class="add-wrap">
            <div class="pannel-content">
                <form action="" class="layui-form">
                    <ul>
                        <li>
                            <div class="layui-form-item">
                                <div class="layui-inline">
                                    <label class="layui-form-label"><span class="req red">*</span>首重重量：</label>
                                    <div class="layui-input-inline">
                                        <input lay-verify="required|number" name="firstweight" class="layui-input" value="123">
                                        <a class="layui-btn layui-btn-sm layui-btn-normal tag">kg</a>
                                    </div>
                                </div>
                                <div class="layui-inline">
                                    <label class="layui-form-label"><span class="req red">*</span>首重费用：</label>
                                    <div class="layui-input-inline">
                                        <input lay-verify="required|number" name="firstfee" class="layui-input" value="123">
                                        <a class="layui-btn layui-btn-sm layui-btn-normal tag">元</a>
                                    </div>
                                </div>
                            </div>
                        </li>
                        <li>
                            <div class="layui-form-item">
                                <div class="layui-inline">
                                    <label class="layui-form-label"><span class="req red">*</span>续重重量：</label>
                                    <div class="layui-input-inline">
                                        <input lay-verify="required|number" name="additionalweight" class="layui-input" value="123">
                                        <a class="layui-btn layui-btn-sm layui-btn-normal tag">kg</a>
                                    </div>
                                </div>
                                <div class="layui-inline">
                                    <label class="layui-form-label"><span class="req red">*</span>续重费用：</label>
                                    <div class="layui-input-inline">
                                        <input lay-verify="required|number" name="additionalfee" class="layui-input" value="123">
                                        <a class="layui-btn layui-btn-sm layui-btn-normal tag">元</a>
                                    </div>
                                </div>
                            </div>
                        </li>
                        <li>
                            <div class="layui-form-item">
                                <label class="layui-form-label"><span class="req red">*</span>满X元免运费：</label>
                                <div class="layui-input-inline">
                                    <input lay-verify="required|number" name="freight" class="layui-input" value="123">
                                    <a class="layui-btn layui-btn-sm layui-btn-normal tag">元</a>
                                </div>
                            </div>
                        </li>
                        <li>
                            <div class="layui-form-item">
                                <label class="layui-form-label"><span class="req red">*</span>配送描述：</label>
                                <div class="layui-input-block">
                                    <input type="text" name="description" class="layui-input" placeholder="请输入配送描述" >
                                </div>
                            </div>
                        </li>
                        <li class="nopadding ps">
                            <dl>
                                <dt>
                                    <label class="checkbox province"><input lay-ignore="" name="province[]" value="0" type="checkbox">其他</label>
                                </dt>
                                <dd>
                                    <ul class="area">
                                        <li><label class="checkbox city"><input lay-ignore="" name="city[]" data-province="0" value="0" type="checkbox">其他</label></li>
                                        <li><label class="checkbox city"><input lay-ignore="" name="city[]" data-province="0" value="1" type="checkbox">北京</label></li>
                                        <li><label class="checkbox city"><input lay-ignore="" name="city[]" data-province="0" value="2" type="checkbox">天津</label></li>
                                        <li><label class="checkbox city"><input lay-ignore="" name="city[]" data-province="0" value="3" type="checkbox">河北</label></li>
                                        <li><label class="checkbox city"><input lay-ignore="" name="city[]" data-province="0" value="4" type="checkbox">山西</label></li>
                                        <li><label class="checkbox city"><input lay-ignore="" name="city[]" data-province="0" value="5" type="checkbox">内蒙古</label></li>
                                        <li><label class="checkbox city"><input lay-ignore="" name="city[]" data-province="0" value="6" type="checkbox">上海</label></li>
                                        <li><label class="checkbox city"><input lay-ignore="" name="city[]" data-province="0" value="7" type="checkbox">江苏</label></li>
                                        <li><label class="checkbox city"><input lay-ignore="" name="city[]" data-province="0" value="8" type="checkbox">浙江</label></li>
                                        <li><label class="checkbox city"><input lay-ignore="" name="city[]" data-province="0" value="9" type="checkbox">安徽</label></li>
                                    </ul>
                                </dd>
                            </dl>
                        </li>
                        <li class="nopadding ps">
                            <dl>
                                <dt>
                                    <label class="checkbox province"><input lay-ignore="" name="province[]" value="0" type="checkbox">其他</label>
                                </dt>
                                <dd>
                                    <ul class="area">
                                        <li><label class="checkbox city"><input lay-ignore="" name="city[]" data-province="0" value="0" type="checkbox">其他</label></li>
                                        <li><label class="checkbox city"><input lay-ignore="" name="city[]" data-province="0" value="1" type="checkbox">北京</label></li>
                                        <li><label class="checkbox city"><input lay-ignore="" name="city[]" data-province="0" value="2" type="checkbox">天津</label></li>
                                        <li><label class="checkbox city"><input lay-ignore="" name="city[]" data-province="0" value="3" type="checkbox">河北</label></li>
                                        <li><label class="checkbox city"><input lay-ignore="" name="city[]" data-province="0" value="4" type="checkbox">山西</label></li>
                                        <li><label class="checkbox city"><input lay-ignore="" name="city[]" data-province="0" value="5" type="checkbox">内蒙古</label></li>
                                        <li><label class="checkbox city"><input lay-ignore="" name="city[]" data-province="0" value="6" type="checkbox">上海</label></li>
                                        <li><label class="checkbox city"><input lay-ignore="" name="city[]" data-province="0" value="7" type="checkbox">江苏</label></li>
                                        <li><label class="checkbox city"><input lay-ignore="" name="city[]" data-province="0" value="8" type="checkbox">浙江</label></li>
                                        <li><label class="checkbox city"><input lay-ignore="" name="city[]" data-province="0" value="9" type="checkbox">安徽</label></li>
                                    </ul>
                                </dd>
                            </dl>
                        </li>
                        <li>
                            <div class="layui-form-item">
                                <label class="layui-form-label">

                                </label>
                                <div class="layui-input-block">
                                    <button class="layui-btn layui-btn-normal" lay-submit>确认提交</button>
                                </div>
                            </div>
                        </li>
                    </ul>
                </form>
            </div>
        </div>
    </div>
    {/if}
</div>
{/block}

{block name="botScript"}
<script>
    $('.pannel-content .province').click(function () {
        $(this).find('input').prop('checked') ? isCheck($(this).parents('.ps').eq(0),'yes') : isCheck($(this).parents('.ps').eq(0),'no');
    });
    $('.area-wrap .province').click(function () {
        $(this).find('input').prop('checked') ? isCheck($(this).parents('tr').eq(0),'yes') : isCheck($(this).parents('tr').eq(0),'no');
    });
    layui.use(['form'], function(){
        var form = layui.form;
        //表单验证
        form.verify({
            username: function(value, item){ //value：表单的值、item：表单的DOM对象
                if(!new RegExp("^[a-zA-Z\u4e00-\u9fa5\\s]+$").test(value)){
                    return '姓名不能有特殊字符';
                }else if(!/^[\S]{2,25}$/.test(value)){
                    return '姓名长度范围应在2到25之间';
                }
            }
        });
    });
</script>
{/block}